var shopxx = {
	base: "",
	locale: "zh_CN"
};
(function($){
	//选号码切换
	$(".chooseNum li").live('click',function(){
		$("#checkPhoneMessage").empty();
		$(this).addClass("on").siblings("li").removeClass("on");
		var phone=$("#phone").find("li.on").text(); //html()
		if(phone!=null)
		{
			var lastSection=phone.substr(phone.length-4,3);
			$("#lastSection").val(lastSection);
		}
		
	});
	
	//验证码倒计时
	$(".getVcode").live('click',function(){
		
		var mobile=$("#mobile").val();
		var phone = /^(1[3-9]{1}[0-9]{1})\d{8}$/;
		if(mobile.length!=11||!phone.test(mobile)){
			alert("请填写正确的手机号！");
			return;
		}
		
		var second = 59,
			_this = $(this);
		_this.addClass("getYzmGray");
		_this.attr("value","60秒后重新获取");
		_this.attr("disabled", "disabled" );
		var si = setInterval(function(){
			_this.attr("value",second+"秒后重新获取");
			second--;
			if( second == -2 ){
				clearInterval(si);
				_this.removeClass("getYzmGray");
				_this.attr("value","获取短信验证码");
				_this.removeAttr("disabled" );
			}
		},1000);
		
		 $.ajax({
				url:"getCode.jhtml",
				data:{mobile:mobile},
				type:"GET",
				dataType: "json",
				cache: false,
				success: function(data) {
				
				}
			});
		 
	});
	
	//显示遮罩层mask
	function showMask(){
		$("#mask").show().css({"height":$(document).height()});
	}
	//关闭遮罩层mask
	function hideMask(){
		$("#mask").hide();
	}
	
	//滚动特效
	function scrollEvt(moveObj,relativeObj){
		var _top = ($(window).height()-moveObj.height())/2;
		$(window).scroll(function(){
			var scrolls = $(window).scrollTop();
			$(moveObj).css({'top':scrolls+_top});
		});
	}
	
	//说明弹出层
	$("#explain").live('click',function(){
		var explainDiv = $("#explainDiv");
		showMask();
		explainDiv.show().css({"top":($(window).height()-explainDiv.height())/2+$(window).scrollTop()});
		scrollEvt($("#explainDiv"),$("#main"))
		$("#explainClose").click(function(){
			hideMask();
			$("#explainDiv").hide();
		});
	});
})(Zepto);